package main

import (
	"fmt"
	"time"
)

func main() {
	// make一个通道
	ch := make(chan int)

	//开启一个并发匿名函数
	go func() {
		fmt.Println("start goroutine")

		time.Sleep(time.Second * 3)

		//通过通道通知main里的goroutine
		ch <- 0
		fmt.Println("exit goroutine")
	}()

	//等待匿名函数goroutine
	fmt.Println("wait goroutine")
	<-ch
	fmt.Println("all done")
}
